package com.fengwk.support.jdbc;

import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface JdbcDatabaseApi<T extends JdbcDatabaseApi<?>> {
	
	T openTransaction() throws JdbcException;
	
	T commitTransaction() throws JdbcException;
	
	T rollbackTransaction() throws JdbcException;
	
	int update(String sql, Object...params) throws JdbcException;
	
	<B> List<B> query(String sql, Class<B> beanClass, Object...params) throws JdbcException;
	
	@Deprecated
	<B, E> List<B> queryWithCollection(String sql, Class<B> beanClass, Collection<E> collection) throws JdbcException;
	
	<B> B querySingle(String sql, Class<B> beanClass, Object...params) throws JdbcException;
	
	@Deprecated
	<B, E> B querySingleWithCollection(String sql, Class<B> beanClass, Collection<E> collection) throws JdbcException;
	
	List<Map<String, Object>> query(String sql, Object...params) throws JdbcException;
	
	@Deprecated
	<E> List<Map<String, Object>> queryWithCollection(String sql, Collection<E> collection) throws JdbcException;
	
	Long getLastInsertId() throws JdbcException;
	
}
